function filterArray (arr, name) {
    const newArr = arr.filter(item => item === name)
    
    return newArr
}

console.log(filterArray(['张三', '李四'], '张三'))